package com.duobaoyu.dby.supply.biz.client.product.converter;

import com.duobaoyu.dby.channel.boundary.bean.order.pojo.OrderExtendParam;
import com.duobaoyu.dby.common.core.constant.CommonConstants;
import com.duobaoyu.dby.common.core.convert.bean.ReferenceMapper;
import com.duobaoyu.dby.saas.product.common.base.json.SkuExtraParam;
import com.duobaoyu.dby.saas.product.common.remote.dto.SkuStockOrderNumDTO;
import com.duobaoyu.dby.saas.product.common.remote.dto.SkuStockQueryDTO;
import com.duobaoyu.dby.saas.product.common.remote.to.PlatformPriceCheckTO;
import com.duobaoyu.dby.saas.product.common.remote.to.SkuStockInfoTO;
import com.duobaoyu.dby.supply.biz.client.product.bean.bo.PlatformPriceCheckBO;
import com.duobaoyu.dby.supply.biz.client.product.bean.bo.SkuInfoCheckBO;
import com.duobaoyu.dby.supply.biz.event.SalesVolumeStatistics;
import com.duobaoyu.dby.supply.common.biz.bo.order.OrderSplitBO;
import com.duobaoyu.dby.supply.common.biz.remote.dto.order.SubmitOrderDTO;
import com.duobaoyu.dby.supply.db.entity.extend.OrderProductParamExtendInfo;
import com.duobaoyu.dby.supply.db.entity.order.OrderProduct;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * 商品转换
 *
 * @author fengshaoyu
 * @version 1.0.0
 * @date 2023/10/7 17:41
 */
@Mapper(uses = {ReferenceMapper.class}, builder = @Builder(disableBuilder = true), componentModel = CommonConstants.COMPONENT_MODEL)
public interface ProductConverter {

	OrderProductParamExtendInfo.PhoneOperator toPhoneOperator(OrderExtendParam.PhoneOperatorParam phoneOperatorParam);


	List<SkuStockQueryDTO.SkuInfo> toSkuStockQueryDTO(List<SubmitOrderDTO.SkuInfo> skuInfos);

	/**
	 * to to bo
	 *
	 * @param errorSkuInfoList to
	 * @return SkuInfoCheckBO.ErrorSkuInfo SkuInfoCheckBO.ErrorSkuInfo
	 */
	List<SkuInfoCheckBO.ErrorSkuInfo> toSkuInfoCheckErrorSkuList(List<SkuStockInfoTO.ErrorSkuInfo> errorSkuInfoList);

	/**
	 * to to bo
	 *
	 * @param skuInfo to
	 * @return SkuInfoCheckBO.SkuInfo SkuInfoCheckBO.SkuInfo
	 */
	@Mapping(source = "skuExtraParam", target = "orderProductParamExtendInfo")
	SkuInfoCheckBO.SkuInfo toSkuInfoCheckSkuList(SkuStockInfoTO.SkuInfo skuInfo);

	/**
	 * to to bo
	 *
	 * @param skuInfoList to
	 * @return SkuInfoCheckBO.SkuInfo SkuInfoCheckBO.SkuInfo
	 */
	List<SkuInfoCheckBO.SkuInfo> toSkuInfoCheckSkuList(List<SkuStockInfoTO.SkuInfo> skuInfoList);


	OrderSplitBO.SplitSkuInfo toOrderSplitSplitSkuInfo(SkuInfoCheckBO.SkuInfo skuInfoBo);

	@Mapping(source = "priceList", target = "tieredPrice")
	OrderProductParamExtendInfo toOrderProductExtendInfo(SkuExtraParam skuExtraParam);

	OrderProductParamExtendInfo.ElectricityFees toElectricityFees(OrderExtendParam.ElectricityFeesParam electricityFeesParam);

    OrderProduct copyOrderProduct(OrderProduct orderProduct);

    PlatformPriceCheckBO toPlatformPriceCheck(PlatformPriceCheckTO platformPriceCheck);

    List<SkuStockOrderNumDTO> toSkuStockOrderNum(List<SalesVolumeStatistics.OrderSalesVolumeStatistics> orderSalesVolumeStatisticsList);
}
